//
//  FHStatus.swift
//  WeiBo
//
//  Created by qfh on 16/7/12.
//  Copyright © 2016年 qiufuhe. All rights reserved.
//

import UIKit

class FHStatus: NSObject {
    
    //  发布微博时间
    var created_at: String?
    //  微博id
    var id: Int64 = 0
    //  微博内容
    var text: String?
    //  来源
    var source: String?
    
    //关注用户对象
    var user: FHUser?
    
    
    //  转发数
    var reposts_count: Int = 0
    //  评论数
    var comments_count: Int = 0
    //  表态数(赞)
    var attitudes_count: Int = 0
    
    // 图片地址
    
    var pic_urls: [FHStatusPictureInfo]?
    
    
    
    
    
//  被转发的微博
    var retweeted_status: FHStatus?
    
    init(dict: [String: AnyObject]) {
        
        super.init()
        
        setValuesForKeysWithDictionary(dict)
        
    }
    
    override func setValue(value: AnyObject?, forKey key: String) {
        
        
        
        if key == "user" {
        
            user = FHUser(dict: (value as! [String: AnyObject]))
        
            return
        }else  if key == "retweeted_status" {
        
            retweeted_status = FHStatus(dict: (value as! [String: AnyObject]))
            return
        
        }else if key == "pic_urls" {
            
            var tempArray = [FHStatusPictureInfo]()
        
            for dict in value as! [[String: AnyObject]] {
            
                tempArray.append(FHStatusPictureInfo(dic: dict))
                
            }
            
            pic_urls = tempArray
            
        
            return
        }
        
      
       super.setValue(value, forKey: key)
        
    }
    
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {
        
    }

}
